package org.example.everyday;

public class Lc693 {

    public static void main(String[] args) {
        Lc693 lc693 = new Lc693();

        boolean result = lc693.hasAlternatingBits(11);
        System.out.println(result);
    }

    public boolean hasAlternatingBits(int n) {
        int a = n ^ (n >> 1);
        System.out.println("a的值"+a+";a的二进制是："+Integer.toBinaryString(a));
        System.out.println("a+1的二进制是："+Integer.toBinaryString(a+1));
        int tt = (a & (a + 1));
        System.out.println(tt);
        return (a & (a + 1)) == 0;
    }



}
